package de.akad.imp03.server;

import java.util.List;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

import de.akad.imp03.client.service.DaoService;
import de.akad.imp03.shared.PersonObjectify;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public class DaoServiceImpl extends RemoteServiceServlet implements DaoService {

	private PersonDao personDao = null;
	
	private PersonDao getPersonDao() {
		if (personDao == null) {
			personDao = new PersonDao();
		}
		return personDao;
	}
	
	public Long savePerson(PersonObjectify p) {
		return getPersonDao().save(p);
	}
	public PersonObjectify loadPerson(Long id) {
		return getPersonDao().load(id);
	}
	public Boolean deletePerson(PersonObjectify p) {
		return getPersonDao().delete(p);
	}
	public List<PersonObjectify> findAllPersons() {
		return getPersonDao().findAll();
	}
	
}
